namespace DynamicProxy;
//一。创建需要被拦截的服务
public class OrderService: IOrderService
{   
    //点单：商品种类和数量
    public void PlaceOrder(string product, int quantity)
    {
        Console.WriteLine($"下单: {quantity} 件 {product}");
        // 模拟处理时间
        System.Threading.Thread.Sleep(new Random().Next(100, 500));
    }
    //结账：计算总价
    public decimal CalculateTotal(decimal unitPrice, int quantity)
    {
        if (quantity <= 0)
            throw new ArgumentException("数量必须大于0", nameof(quantity));
        return unitPrice * quantity;
    }
    
}